import { CoolController, BaseController } from '@cool-midway/core';
import { TaskTopicEntity } from '../../entity/topic';
import { TaskAppEntity } from '../../entity/app';
import { TaskTopicService } from '../../service/topic';

/**
 * 任务话题
 */
@CoolController({
  api: ['add', 'delete', 'update', 'info', 'list', 'page'],
  entity: TaskTopicEntity,
  service: TaskTopicService,
  pageQueryOp: {
    keyWordLikeFields: ['b.name'],
    fieldEq: [
      { requestParam: 'appId', column: 'a.appId' },
      { requestParam: 'status', column: 'a.status' },
      { requestParam: 'type', column: 'a.type' },
    ],
    select: ['a.*', 'b.name as appName'],
    join: [{ entity: TaskAppEntity, alias: 'b', condition: 'a.appId = b.id' }],
  },
})
export class AdminTaskTopicController extends BaseController {}
